home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
glass
/
glass.lha
/
GLASS
/
dtm
/
test10.gl
< prev
next >
Wrap
Text File
|
1991-06-18
|
1KB
|
52 lines
Basetype E;
Atom
not :- E => E,
and2 :- E & E => E,
and3 :- E & E & E => E,
nand :- E & E => E,
nand3 :- E & E & E => E,
nand4 :- E & E & E & E => E,
one :- <> => E,
init :- <> => E;
Def
dff :- E & E & E & E => E & E;
dff [ck,d,clr,pr] = [q,q']
where
q = nand3 [q',q1,pr];
q' = nand3 [q,q2,clr];
q1 = nand3 [u1, ck, clr];
u1 = nand3 [u4, q1, pr];
q2 = nand3 [q1, ck, u4];
u4 = nand3 [q2, d, clr];
endwhere;
Def
jkff :- E & E & E & E => E & E;
jkff [ck, j, k, clr] = [q,q']
where
q = nand [q',a];
q' = nand3 [q,clr,b];
a = nand [ck', q1];
b = nand [ck', q1'];
q1 = nand [q1', c];
q1' = nand3 [q1,clr,d];
c = nand4 [ck, q', j,clr];
d = nand3 [ck, q, k];
ck' = not ck;
endwhere;
Def simp :- E & E => E & E & E & E;
simp [reset, ck] = [q0,q1,q2,q3]
where
[q0,q0'] = jkff [ck, one [], one [], reset];
[q1,q1'] = jkff [ck, t0, t0, reset];
[q2,q2'] = jkff [ck, t1, t1, reset];
[q3,q3'] = jkff [ck, t2, t2, reset];
t0 = q0;
t1 = and2 [q0, q1];
t2 = and3 [q0, q1, q2];
endwhere;